﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Acoris.Platform
{
    using Acoris.Document;
    using Acoris.Media;
    using Acoris.Foundation;
    using Acoris.Rendering;

#if WIN2D && NET_UWP
    using System.Numerics;
    

    using Microsoft.Graphics.Canvas;
    using Microsoft.Graphics.Canvas.Brushes;
    using Microsoft.Graphics.Canvas.Effects;
    using Microsoft.Graphics.Canvas.Geometry;
    using Microsoft.Graphics.Canvas.Text;



    //class WindowsResourceFactory : IDrawingResourceFactory
    //{
    //    private CanvasDrawingSession m_session;
    //    private BrushConverter      m_brushConverter;

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="canvas"></param>
    //    public WindowsResourceFactory(ICanvasResourceCreator canvas)
    //    {
    //        this.Device = canvas ?? throw new ArgumentNullException();
    //        m_brushConverter = new BrushConverter(canvas);
    //    }


    //    /// <summary>
    //    /// 使用指定的参数创建椭圆形
    //    /// </summary>
    //    /// <param name="pos">创建椭圆的位置</param>
    //    /// <param name="radiusX">椭圆的X轴半径</param>
    //    /// <param name="radiusY">椭圆的Y轴半径</param>
    //    /// <returns>返回一个表示椭圆的绘图资源</returns>
    //    public CanvasGeometry CreateEllipse(Vector2 pos,float radiusX,float radiusY)
    //    {
    //        return CanvasGeometry.CreateEllipse(Device, pos, radiusX, radiusY);
    //    }

    //    /// <summary>
    //    /// 使用指定的参数创建椭圆形
    //    /// </summary>
    //    /// <param name="x">创建椭圆的X坐标</param>
    //    /// <param name="y">创建椭圆的Y坐标</param>
    //    /// <param name="radiusX">椭圆的X轴半径</param>
    //    /// <param name="radiusY">椭圆的Y轴半径</param>
    //    /// <returns>返回一个表示椭圆的绘图资源</returns>
    //    public CanvasGeometry CreateEllipse(float x, float y, float radiusX, float radiusY)
    //    {
    //        return CanvasGeometry.CreateEllipse(Device, x, y, radiusX, radiusY);
    //    }

        
    //    public CanvasGeometry CreateInk()
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public CanvasGeometry CreateLine()
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public CanvasGeometry CreatePath()
    //    {
    //        throw new NotImplementedException();
    //    }

    //    public CanvasGeometry CreatePolygon()
    //    {
    //        throw new NotImplementedException();
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="x"></param>
    //    /// <param name="y"></param>
    //    /// <param name="width"></param>
    //    /// <param name="height"></param>
    //    /// <returns></returns>
    //    public CanvasGeometry CreateRectangle(float x,float y,float width,float height)
    //    {
    //        return CanvasGeometry.CreateRectangle(this.Device,
    //                                              x,
    //                                              y,
    //                                              width,
    //                                              height);
    //    }


    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="x"></param>
    //    /// <param name="y"></param>
    //    /// <param name="width"></param>
    //    /// <param name="height"></param>
    //    /// <param name="radiusX"></param>
    //    /// <param name="radiusY"></param>
    //    /// <returns></returns>
    //    public CanvasGeometry CreateRoundedRectangle(float x, float y, float width, float height,float radiusX,float radiusY)
    //    {
    //        return CanvasGeometry.CreateRoundedRectangle(this.Device,
    //                                                    x,
    //                                                    y,
    //                                                    width,
    //                                                    height,
    //                                                    radiusX,
    //                                                    radiusY);
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="text"></param>
    //    /// <param name="textFormat"></param>
    //    /// <returns></returns>
    //    public CanvasTextLayout CreateTextLayout(string text,CanvasTextFormat textFormat)
    //    {
    //        var textLayout = new CanvasTextLayout(this.Device,
    //                                    text,
    //                                    textFormat,
    //                                    100,
    //                                    100);
    //        return textLayout;
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="brush"></param>
    //    /// <returns></returns>
    //    public ICanvasBrush GetBrush(Brush brush)
    //    {
    //        return m_brushConverter.Convert(brush);
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="strokeStyle"></param>
    //    /// <returns></returns>
    //    public CanvasStrokeStyle GetStrokeStyle(StrokeStyle strokeStyle)
    //    {
    //        return StrokeStyleHelper.GetStrokeStyle(strokeStyle);
    //    }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    /// <param name="format"></param>
    //    /// <returns></returns>
    //    public CanvasTextFormat GetTextFormat(RenderFormat format)
    //    {
    //        return new CanvasTextFormat
    //        {
    //            HorizontalAlignment = AlignmentHelper.GetHorizontalAlignment(format.HorizontalAlignment),
    //            VerticalAlignment = AlignmentHelper.GetVerticalAlignment(format.VerticalAlignment),
    //            FontWeight = FontHelper.GetFontWeight(format.FontWeight),
    //            FontFamily = FontHelper.GetFontFamily(format.FontFamily),
    //            FontSize = format.FontSize,
    //            FontStyle = FontHelper.GetFontStyle(format.FontStyle),
    //            FontStretch =  Windows.UI.Text.FontStretch.Normal,
    //            LineSpacing = format.LineHeight,                  
    //        };
    //    }

    //    #region Property

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    public CanvasDrawingSession DrawingContext { get; set; }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    public ICanvasResourceCreator Device { get; private set; }

    //    /// <summary>
    //    /// 
    //    /// </summary>
    //    public bool Initializable { get; private set; }

    //    #endregion
    //}

#endif
}
